<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
</head>
<body>
<h1>员工编辑</h1>
<form action="/employee/saveOrUpdate" method="POST">
    <input type="hidden" name="id" value="${emp.id}">
    <c:if test="${emp==null}">
        员工账户:<input type="text" name="username" value="${emp.username}"><br>
    </c:if>
    <c:if test="${emp!=null}">
        员工账户:<input type="text" name="username" value="${emp.username}" disabled><br>
    </c:if>
    员工名称:<input type="text" name="name" value="${emp.name}"><br>
    <c:if test="${emp==null}">
        员工密码:<input type="text" name="password" value="${emp.password}"><br>
    </c:if>
    员工邮箱:<input type="text" name="email" value="${emp.email}"><br>
    员工年龄:<input type="text" name="age" value="${emp.age}"><br>
    员工部门:<select name="dept.id">
    <option value="-1">请选择</option>
    <c:forEach items="${deptList}" var="dept">
        <option value="${dept.id}" ${dept.id == emp.dept.id ? "selected" : ""}>
                ${dept.name}
        </option>
    </c:forEach>
</select><br/>
    是否管理员:<input type="checkbox" name="admin" value="1" ${emp.admin?"checked":""}><br>
    <input type="submit" value="提交">
</form>
</body>
</html>